const {
  userCollection,
  envid,
  } = require('./config.js');

// 云函数入口文件
const cloud = require('wx-server-sdk')

cloud.init({
  env: envid,
  traceUser: true
})


const db = cloud.database()
// 云函数入口函数
exports.main = async (event, context) => {
  console.log(event, '26-26 index.js main, event...');
  try {
    return await db.collection(userCollection).doc(event._id).update({
     // data 传入需要局部更新的数据
     data: {
       user: event.data,
     },
    })
   } catch (e) {
    console.error(e)
   }

}